<template>
  <div class="cart">
    <nav-bar class="cart-nav"
      ><div slot="center">购物车({{ cartLength }})</div></nav-bar
    >
    <!-- 列表组件 -->
    <cart-list></cart-list>
  </div>
</template>

<script>
// 导航组件
import NavBar from "../../components/common/navbar/NavBar";
// 列表组件
import CartList from "./childComps/CartList";
import { mapGetters } from "vuex";
export default {
  components: {
    NavBar,
    CartList
  },
  computed: {
    // 使用对象展开运算符将 getter 混入 computed 对象中
    ...mapGetters(["cartLength"])
  }
};
</script>

<style lang="less" scoped>
.cart {
  height: 100vh;
}
.cart-nav {
  background: var(--color-tint);
  color: #fff;
}

</style>
